
#include "IO.h"
#include "BSP_Config.h"

#if (BSP_BUZZER_TYPE == BSP_IO_BUZZER_ENABLE)

#define BUZ_S_ON	1
#define BUZ_S_OFF	0


static const IO_T Buzzer =
{
    (void*)BUZ_GP, BUZ_PIN
};
	
/**
    \brief      configure the GPIO ports
    \param[in]  none
    \param[out] none
    \retval     none
  */
static void BSP_Buzzer_IO_Init(void)
{
	IO_Init(&Buzzer, IO_Mode_OUT);
}



void BSP_Buzzer_Set(uint8_t state){
	IO_Set(&Buzzer, state ? BUZ_S_ON: BUZ_S_OFF);
}

uint8_t BSP_Buzzer_State(void){
	uint8_t state = IO_Get(&Buzzer) ? 1 : 0;
	return state != BUZ_S_OFF ? 1 : 0;
}

void BSP_Buzzer_Init(void)
{
	BSP_Buzzer_IO_Init();
	BSP_Buzzer_Set(BUZ_S_OFF);
}
#endif 



